import './index.html';
import dva from 'dva';
import createLoading from 'dva-loading';
import { browserHistory } from 'dva/router';
import moment from 'moment';
import 'moment/locale/zh-cn';
import login from './models/login';
import { errorMessage } from './configs/error';
moment.locale('zh-cn');

// 1. Initialize
const app = dva({
	...createLoading({
		effects: true,
	}),
	history: browserHistory,
	onError(error) {
		errorMessage(error);
	},
});

// 2. Model
app.model(require('./models/app'));
app.model(require('./models/sysUser'));
app.model(login);
app.model(require('./models/productList'));

// 3. Router
app.router(require('./router'));

// 4. Start
app.start('#root');
